<?php 
/**
 * Joomla! 1.5 component ArticleCashRewards
 *
 * @version $Id: referrals.php 2009-07-25 01:47:01 svn $
 * @author Maverick
 * @package Joomla.components.com_articlecashrewards
 * @subpackage views.mypage.tmpl
 * @link http://joomladev.boddunan.com
 * @license GNU/GPL
 *
 * Review and approve the articles and assign points and cash rewards.
 * Users can see their articles and the points/cash rewards assigned in the front-end module.
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

include('tabs.php');
?>
<div class="current"><dd style="display: block;"> 
<form action="index.php?option=com_articlecashrewards" method="post" name="adminForm">
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<?php 
if ( $this->rows ) {
?>
	<thead>
		<tr>
			<th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="30px;"><div align="center">#</div></th>
			<th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>"><div align="left"><?php echo JText::_('LABEL_REFERRAL'); ?></div></th>
			<th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="28%"><div align="left"><?php echo JText::_('LABEL_LEVEL'); ?></div></th>
			<th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="10%"><div align="left"><?php echo JText::_('LABEL_ARTICLES'); ?></div></th>
			<th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="15%"><div align="left"><?php echo JText::_('LABEL_EARNINGS'); ?></div></th>
			<th class="sectiontableheader<?php echo $this->params->get( 'pageclass_sfx' ); ?>" width="5%"><div align="left"><?php echo JText::_('LABEL_STATUS'); ?></div></th>
		</tr>
	</thead>
	<tbody>
<?php
	$i = 0;
	$k = 0;
	foreach ($this->rows as $row) {
?>
		<tr>
			<td class="sectiontableentry<?php echo $k; ?>" width="10%"><div align="center"><?php echo $this->pagination->getRowOffset( $i); ?></div></td>
			<td align="left">
                <?php echo $row->referral; ?>
			</td>
			<td align="left">
				<?php echo $row->level; ?>
			</td>
			<td align="left">
				<?php echo ($row->articles == 0)?'NA':$row->articles; ?>
			</td>
			<td align="left">
				<?php echo $row->earnings; ?>
			</td>
			<td align="left">
				<?php
					if($row->status == 1){
						$img = 'published.png';
						$alt = 'APPROVED';
					}else if($row->status == 2){
						$img = 'rejected.png';
						$alt = 'REJECTED';
					}else{
						$img = 'pending.png';
						$alt = 'PENDING';
					}
				 ?>
				<img src="components/com_articlecashrewards/assets/images/<?php echo $img; ?>" border="0" title="<?php echo JText::_( $alt ); ?>" alt="<?php echo JText::_( $alt ); ?>" />
			</td>
		</tr>
<?php
		$i++;
		$k = 1 - $k;
 	 }
?>
	</tbody>
	<tfoot>
		<tr>
			<td colspan="6">
			<?php
				echo $this->pagination->getPagesLinks();
				echo $this->pagination->getPagesCounter();
			?>
			</td>
		</tr>
        <tr>
            <td align="center" colspan="6" nowrap="nowrap">
                <div style="font-size: 9px;;">
                Article Cash Rewards powered by <a href="http://boddunan.com">boddunan.com</a>
                </div>
            </td>
        </tr>
	</tfoot>
<?php }else{ ?>
    <tr>
        <td>
            <?php echo JText::_('MSG_NO_REFERRALS'); ?>
        </td>
    </tr>
<?php } ?>
</table>
<input type="hidden" name="option" value="com_articlecashrewards" />
<input type="hidden" name="controller" value="mypage" />
<input type="hidden" name="task" value="referrals" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
</dd>
</div>